package com.example.petshop.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.petshop.entity.Cart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CartMapper extends BaseMapper<Cart> {
    List<Cart> getAllCarts();

    int deleteByIds(List<Integer> cartids);

    List<Cart> getCartsByUserId(Long userId);

    int updateQuantityById(@Param("cartid") Integer cartid, @Param("quantity") Integer quantity);

    Cart getCartByGoodsIdAndUserId(@Param("goodsId") Integer goodsId, @Param("userId") Long userId);

    int updateCart(Cart existingCart);

    // 可以添加自定义的数据库操作方法
}